﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using EvoWars.Stuffs.TankStuff;
using EvoWars2.Stuffs;
using Microsoft.Xna.Framework;

namespace EvoWars.Stuffs
{
    public class World
    {
        public int Width { get; set; }
        public int Height { get; set; }
        public List<Tank> Players { get; set; }
        public Texture2D Texture { get; set; }
        public CollisionDetection2D ColDetector { get; set; }

        public World()
        {
            Players = new List<Tank>();
            ColDetector = new CollisionDetection2D();
        }


        public bool IsPlayerCollidingWithPlayer(Tank movingPlayer)
        {
            bool isColliding = false;

            List<Rectangle> bbList = new List<Rectangle>();
            foreach (Tank player in Players)
            {
                if (player != movingPlayer)
                {
                    bbList.Add(player.BoundingBox);
                }
            }

            return ColDetector.IsCollidingWithAny(movingPlayer.BoundingBox, bbList);

        }


    }
}
